#include <bits/stdc++.h>
using namespace std;
const int maxn = 40000+10, x = 123;
typedef unsigned long long ull;
int m, n, ans , pos, rk[maxn];
ull h[maxn], hl[maxn], ex[maxn];
char s[maxn];

bool cmp(const int &a, const int &b){
    return hl[a]<hl[b] || (hl[a]==hl[b] && a<b);
}

bool can(int len){
    for (int i = 0; i < n-len+1; ++i) {
        rk[i] = i;
        hl[i] = h[i] - h[i+len]*ex[len];
    }
    sort(rk, rk+n-len+1, cmp);
    pos = -1;
    int c;
    for (int i = 0; i < n - len + 1; ++i) {
        if(!i || hl[rk[i]]!=hl[rk[i-1]]) c=0;
        if(++c>=m) pos = max(pos, rk[i]);
    }
    return pos!=-1;
}


int main() {
    while (scanf("%d", &m)==1 && m){
        scanf("%s", &s);
        n = strlen(s);
        h[n] = 0;
        for (int i = n-1; i >=0; --i) {
            h[i] = h[i+1]*x+s[i]-'a';
        }
        ex[0] = 1;
        for (int i = 1; i <= n; ++i) {
            ex[i] = ex[i-1]*x;
        }
        if(!can(1)) {printf("none\n"); continue;}
        int l = 1, r = n;
        while (r>=l){
            int M = l+(r-l)/2;
            if(can(M))
                ans = M, l = M+1;
            else r = M-1;
        }
        can(ans);
        printf("%d %d\n", ans, pos);
    }
    return 0;
}